package my12306;

public class BuyThread implements Runnable {
    Ticket t;//票对象

    public BuyThread(Ticket t) {
        this.t = t;
    }

    public BuyThread() {
    }

    @Override
    public void run() {
        while (true) {
            try {
                t.sale();//购票
                Thread.sleep(1000);//睡一秒

            } catch (MyException e) {
                e.printStackTrace();
                /*System.out.println(e.getMessage());*/
                System.exit(0);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }
}
